#pragma once
#include <windows.h>

#include "Physics\Dynamics\Entity\hkpRigidBody.h"
#include "Physics\Collide\Shape\hkpShape.h"
#include "Physics\Utilities\CharacterControl\StateMachine\hkpCharacterState.h"
#include "Physics\Utilities\CharacterControl\CharacterRigidBody\hkpCharacterRigidBody.h"
#include <Physics/Utilities/CharacterControl/StateMachine/hkpDefaultCharacterStates.h>

#include "..\common\def.h"
#include "..\common\string.h"
#include "..\common\arraylist.hpp"
#include "..\engine\object.h"
#include "..\render\d3d_mesh.h"
#include "..\math\matrix.h"
#include "actor.h"

class EE_EXPORT CCharacterActor : public CActor
{
	friend class CPhysics;
private:	

	hkpCharacterContext* m_characterContext;
	hkpCharacterRigidBody* m_characterRigidBody;
	
	hkpCharacterStateOnGround* pGroundState;
	hkpCharacterStateInAir* pAirState;
	hkpCharacterStateJumping* pJumpState;

	void Simulate();
	CCharacterActor(CPhysics* const pPhysics);


public:
	
	~CCharacterActor();
	void ApplyMovement(const Vector3f& deltaMovement);
	void ApplyMovement(const float walkSpeed, const float sidestepSpeed, const Vector3f& forwardDirection, const bool jump);
	HRESULT Create(const string &filename, CActor::ActorData actorData = CActor::ActorData(),CObject *pParent = NULL);
	
	enum CharacterState { ON_GROUND = 0, IN_AIR, JUMPING, OTHER};


	CharacterState GetState();

};
